﻿<%@ Page Title="Report Filters - Press" Language="C#" MasterPageFile="~/user.master"
    AutoEventWireup="true" Inherits="MediaMonitor.Users.Report_Press_Filter" Theme="default"
    CodeBehind="report-press-filter.aspx.cs" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="~/Controls/AutoCompleteExtender.ascx" TagPrefix="ctrl" TagName="AutoComplete" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
    <link href="../rad-scripts/Grid.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/Input.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/Menu.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/slider.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/Calendar.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">

            function DateSelected(sender, eventArgs) {


                var date = eventArgs.get_renderDay().get_date();
                var dfi = sender.DateTimeFormatInfo;
                var formattedDate = dfi.FormatDate(date, dfi.ShortDatePattern);

                var calE = $find("<%= calE.ClientID %>");

                calE.selectDate(date, true)

            } 
        </script>
    </telerik:RadCodeBlock>
    <style type="text/css">
        .AutoExtender
        {
            font-family: Verdana, Helvetica, sans-serif;
            font-size: .8em;
            font-weight: normal;
            border: solid 1px #006699;
            line-height: 20px;
            padding: 10px;
            background-color: White;
            margin-left:0px;
        }
        .AutoExtenderList
        {
            border-bottom: dotted 1px #006699;
            cursor: pointer;
            color: Maroon;
        }
        .AutoExtenderHighlight
        {
            color: White;
            background-color: #006699;
            cursor: pointer;
        }
        #divwidth
        {
          width: 200px !important;    
        }
        #divwidth div
       {
        width: 200px !important;   
       }
 </style>
    <%-- <script type="text/javascript"> 
        // Hook up to the AutoComplete populating/populated events
        function pageLoad() {
            var autoComplete_prod = $find('AutoCompleteEx_acProduct'); //find by BehviorID
            if (!autoComplete_prod) return;
            var target = autoComplete_prod.get_element();
            if (!target) return;
            var brandCode = $get('acBrand_SelectedValue');
            if (!brandCode) return;

            alert(brandCode.value);
            // Dynamically assign the context and change the color when processing
            autoComplete_prod.add_populating(function () {
                autoComplete_prod.set_contextKey(brandCode.value);
                AjaxControlToolkit.Animation.ColorAnimation.play(target, 1, 20, 'style', 'backgroundColor', '#FFFFFF', '#EFC4C1');
            });
            autoComplete_prod.add_populated(function () {
                AjaxControlToolkit.Animation.ColorAnimation.play(target, 1, 20, 'style', 'backgroundColor', '#EFC4C1', '#FFFFFF');
            });
        }
    </script>
    --%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
    <asp:Panel ID="pnlSearch" runat="server">
        <table>
            <tr>
                <td colspan="2">
                    <b>Dates</b><br />
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <table>
                        <tr valign="top">
                            <td>
                                From Date
                                <br />
                                <telerik:RadCalendar AutoPostBack="false" ID="calS" runat="server" EnableMultiSelect="false"
                                    ClientEvents-OnDateSelected="DateSelected">
                                </telerik:RadCalendar>
                            </td>
                            <td>
                                <div style="width: 50px;">
                                </div>
                            </td>
                            <td>
                                To Date
                                <br />
                                <telerik:RadCalendar AutoPostBack="false" ID="calE" runat="server" EnableMultiSelect="false">
                                </telerik:RadCalendar>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <small><u class="ErrorText">Note:</u> only dates in blue color are valid dates having
                                    commercial's data.</small>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br />
                    <br />
                    <b>Media</b><br />
                    <br />
                </td>
            </tr>
            <tr valign="top">
                <td>
                    Media Type
                </td>
                <td>
                    <asp:DropDownList ID="lstMediaType" runat="server" AutoPostBack="true" DataValueField="MediaTypeCode"
                        DataTextField="MediaTypeName" OnSelectedIndexChanged="lstMediaType_SelectedIndexChanged" />
                    <br />
                    <br />
                </td>
            </tr>
            <tr valign="top">
                <td>
                    Channel / Media Name
                </td>
                <td style="font-size: small;">
                    <script type="text/javascript">
                        function chkAllMedia_Clicked(obj) {
                            var selected = document.getElementById('<%=chkAllMedia.ClientID%>').checked;
                            if (selected)
                                document.getElementById('dvMediaList').style.display = 'none';
                            else
                                document.getElementById('dvMediaList').style.display = 'block';
                        }
                    </script>
                    <asp:CheckBox ID="chkAllMedia" runat="server" Text="Search from all Media Channels"
                        Checked="true" />
                    <div id="dvMediaList" style="display: none;" class="Box">
                        <asp:CheckBoxList ID="lstMedia" runat="server" DataValueField="MediaCode" DataTextField="MediaName"
                            RepeatColumns="5" RepeatDirection="Horizontal" Font-Size="8px">
                        </asp:CheckBoxList>
                    </div>
                    <script type="text/javascript">
                        document.getElementById('<%=chkAllMedia.ClientID%>').onclick = chkAllMedia_Clicked;
                    </script>
                    <%-- 
                <asp:DropDownList ID="lstMedia"  runat="server" AutoPostBack="true"
                    DataTextField="MediaName" DataValueField="MediaCode" 
                    onselectedindexchanged="lstMedia_SelectedIndexChanged" />
                    --%>
                    <br />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br />
                    <b>Products</b><br />
                    <br />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:UpdatePanel ID="pnlUpdate_prod" runat="server">
                        <ContentTemplate>
                            <table>
                                <tr valign="top">
                                    <td style="width: 133px;">
                                        Sector
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstSector" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lstSector_Changed"
                                            DataTextField="SectorName" DataValueField="SectorID" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Sub Sector
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstSubSector" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lstSubSector_Changed"
                                            DataTextField="SubSectorName" DataValueField="SubSectorID" />
                                        <br />
                                    </td>
                                </tr>
                                <tr style='display: <%=AppUser.GetCountry()==177 ? "table-row": "none" %>'>
                                    <td>
                                        Sub Sector 2
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstSubSector2" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lstSubSector_Changed"
                                            DataTextField="SubSectorName" DataValueField="SubSectorID" />
                                        <br />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Category
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstCategory" runat="server" DataTextField="CategoryName" DataValueField="CategoryID" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <br />
                                        <br />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Advertiser
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstAdvertiser" runat="server" DataTextField="AdvertiserName"
                                            DataValueField="AdvertiserID" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Agency
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstAgency" runat="server" DataTextField="AgencyName" DataValueField="AgencyID" />
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br />
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                    <%--Brand--%>
                    Product
                </td>
                <td>
                    <ctrl:AutoComplete ID="acBrand" runat="server" MinimumPrefixLength="2" ServicePath="~/users/report-press-filter.aspx"
                        ServiceMethod="AutoComplete_FillBrand" completionsetcount="10" />
                </td>
            </tr>
            <tr style="display: none">
                <td>
                    Product
                </td>
                <td>
                    <ctrl:AutoComplete ID="acProduct" runat="server" MinimumPrefixLength="2" ServicePath="~/users/report-press-filter.aspx"
                        ServiceMethod="AutoComplete_FillProduct" completionsetcount="10" />
                </td>
            </tr>
            <tr>
                <td>
                    Version
                </td>
                <td>
                    <ctrl:AutoComplete ID="acVersion" runat="server" MinimumPrefixLength="2" ServicePath="~/users/report-press-filter.aspx"
                        ServiceMethod="AutoComplete_FillVersion" completionsetcount="10" />
                </td>
            </tr>
            <tr style="display: none;">
                <td colspan="4">
                    <br />
                    <br />
                    <b>Options</b><br />
                    <br />
                </td>
                <td colspan="3">
                    <table>
                        <tr>
                            <td>
                                Start Time
                            </td>
                            <td colspan="3">
                                <asp:DropDownList ID="lstStartTime" runat="server">
                                    <asp:ListItem Value="0">Any</asp:ListItem>
                                    <asp:ListItem Value="20000">02:00</asp:ListItem>
                                    <asp:ListItem Value="30000">03:00</asp:ListItem>
                                    <asp:ListItem Value="40000">04:00</asp:ListItem>
                                    <asp:ListItem Value="50000">05:00</asp:ListItem>
                                    <asp:ListItem Value="60000">06:00</asp:ListItem>
                                    <asp:ListItem Value="70000">07:00</asp:ListItem>
                                    <asp:ListItem Value="80000">08:00</asp:ListItem>
                                    <asp:ListItem Value="90000">09:00</asp:ListItem>
                                    <asp:ListItem Value="100000">10:00</asp:ListItem>
                                    <asp:ListItem Value="110000">11:00</asp:ListItem>
                                    <asp:ListItem Value="120000">12:00</asp:ListItem>
                                    <asp:ListItem Value="130000">13:00</asp:ListItem>
                                    <asp:ListItem Value="140000">14:00</asp:ListItem>
                                    <asp:ListItem Value="150000">15:00</asp:ListItem>
                                    <asp:ListItem Value="160000">16:00</asp:ListItem>
                                    <asp:ListItem Value="170000">17:00</asp:ListItem>
                                    <asp:ListItem Value="180000">18:00</asp:ListItem>
                                    <asp:ListItem Value="190000">19:00</asp:ListItem>
                                    <asp:ListItem Value="200000">20:00</asp:ListItem>
                                    <asp:ListItem Value="210000">21:00</asp:ListItem>
                                    <asp:ListItem Value="220000">22:00</asp:ListItem>
                                    <asp:ListItem Value="230000">23:00</asp:ListItem>
                                    <asp:ListItem Value="240000">24:00</asp:ListItem>
                                    <asp:ListItem Value="250000">25:00</asp:ListItem>
                                    <asp:ListItem Value="260000">26:00</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                End Time &nbsp; &nbsp;
                                <asp:DropDownList ID="lstEndTime" runat="server">
                                    <asp:ListItem Value="0">Any</asp:ListItem>
                                    <asp:ListItem Value="20000">02:00</asp:ListItem>
                                    <asp:ListItem Value="30000">03:00</asp:ListItem>
                                    <asp:ListItem Value="40000">04:00</asp:ListItem>
                                    <asp:ListItem Value="50000">05:00</asp:ListItem>
                                    <asp:ListItem Value="60000">06:00</asp:ListItem>
                                    <asp:ListItem Value="70000">07:00</asp:ListItem>
                                    <asp:ListItem Value="80000">08:00</asp:ListItem>
                                    <asp:ListItem Value="90000">09:00</asp:ListItem>
                                    <asp:ListItem Value="100000">10:00</asp:ListItem>
                                    <asp:ListItem Value="110000">11:00</asp:ListItem>
                                    <asp:ListItem Value="120000">12:00</asp:ListItem>
                                    <asp:ListItem Value="130000">13:00</asp:ListItem>
                                    <asp:ListItem Value="140000">14:00</asp:ListItem>
                                    <asp:ListItem Value="150000">15:00</asp:ListItem>
                                    <asp:ListItem Value="160000">16:00</asp:ListItem>
                                    <asp:ListItem Value="170000">17:00</asp:ListItem>
                                    <asp:ListItem Value="180000">18:00</asp:ListItem>
                                    <asp:ListItem Value="190000">19:00</asp:ListItem>
                                    <asp:ListItem Value="200000">20:00</asp:ListItem>
                                    <asp:ListItem Value="210000">21:00</asp:ListItem>
                                    <asp:ListItem Value="220000">22:00</asp:ListItem>
                                    <asp:ListItem Value="230000">23:00</asp:ListItem>
                                    <asp:ListItem Value="240000">24:00</asp:ListItem>
                                    <asp:ListItem Value="250000">25:00</asp:ListItem>
                                    <asp:ListItem Value="260000">26:00</asp:ListItem>
                                </asp:DropDownList>
                                <asp:CompareValidator ID="cvTime" runat="server" ControlToValidate="lstEndTime" ControlToCompare="lstStartTime"
                                    Operator="GreaterThanEqual" Type="Integer" ErrorMessage="End Time must be greater"
                                    Display="Dynamic" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr style="display: none;">
                <td>
                    Color Code
                </td>
                <td colspan="3">
                    <asp:DropDownList ID="lstColorCode" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr style="display: none;">
                <td>
                    Columns
                </td>
                <td colspan="3">
                    From
                    <asp:DropDownList ID="lstColumnsS" runat="server">
                    </asp:DropDownList>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To &nbsp; &nbsp;
                    <asp:DropDownList ID="lstColumnsE" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr style="display: none;">
                <td>
                    Inches
                </td>
                <td colspan="3">
                    From
                    <asp:DropDownList ID="lstInchesS" runat="server">
                    </asp:DropDownList>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To &nbsp; &nbsp;
                    <asp:DropDownList ID="lstInchesE" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr style="display: none;">
                <td>
                    Location (Page)
                </td>
                <td colspan="3">
                    <asp:TextBox ID="tbPageNumber" runat="server" />
                    <asp:RangeValidator ID="rvPageNumber" ControlToValidate="tbPageNumber" runat="server"
                        Type="Integer" MinimumValue="1" MaximumValue="500" ErrorMessage="Invalid" Text="*"></asp:RangeValidator>
                </td>
            </tr>
            <tr style="display: none;">
                <td>
                    Price From
                </td>
                <td colspan="3">
                    <asp:TextBox ID="tbPriceFrom" runat="server" Width="80"></asp:TextBox>
                    <asp:RangeValidator ID="rvPriceFrom" runat="server" ControlToValidate="tbPriceFrom"
                        Display="Dynamic" ErrorMessage="Invalid price" MaximumValue="9999" MinimumValue="0"
                        Text="Invalid price" Type="Currency" />
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Price To &nbsp; &nbsp;
                    <asp:TextBox ID="tbPriceTo" runat="server" Width="80"></asp:TextBox>
                    <asp:RangeValidator ID="rvPriceTo" runat="server" ControlToValidate="tbPriceTo" Display="Dynamic"
                        ErrorMessage="Invalid price" MaximumValue="9999" MinimumValue="0" Text="Invalid price"
                        Type="Currency" />
                </td>
            </tr>
            <tr>
                <td>
                    Report Fields
                </td>
                <td colspan="3">
                    <asp:CheckBoxList ID="lstFields" runat="server" RepeatLayout="Table" RepeatDirection="Horizontal"
                        RepeatColumns="6">
                        <asp:ListItem Value="MediaTypeName">Media Type</asp:ListItem>
                        <asp:ListItem Value="MediaName" Selected="True">Media / Channel</asp:ListItem>
                        <asp:ListItem Value="AgencyName">Agency</asp:ListItem>
                        <asp:ListItem Value="AdvertiserName" Selected="True">Advertiser</asp:ListItem>
                        <%--<asp:ListItem value="BrandName">Brand</asp:ListItem>--%>
                        <asp:ListItem Value="ProductName" Selected="True">Product</asp:ListItem>
                        <asp:ListItem Value="ProdVersionName">Version</asp:ListItem>
                        <asp:ListItem Value="ColorName">Color Ad</asp:ListItem>
                        <%--<asp:ListItem value="ClassCode">Class Code</asp:ListItem> --%>
                        <%--<asp:ListItem Value="Tipology">Typology</asp:ListItem>
                    
                    <asp:ListItem Value="PageType">PageType</asp:ListItem>--%>
                        <asp:ListItem Value="Wide">Centimeters</asp:ListItem>
                        <asp:ListItem Value="Length">Column</asp:ListItem>
                        <asp:ListItem Value="PressBodyName">Section</asp:ListItem>
                        <asp:ListItem Value="PageNumber">Page Number</asp:ListItem>
                        <asp:ListItem Value="SectorName">Sector</asp:ListItem>
                        <asp:ListItem Value="SubSectorName">SubSector</asp:ListItem>
                        <asp:ListItem Value="CategoryName">Category</asp:ListItem>
                        <asp:ListItem Value="RealCost" Selected="True">Investment</asp:ListItem>
                        <%--
                    <asp:ListItem Value="TimeStartFormatted" Selected="True">Start Time</asp:ListItem>
                    <asp:ListItem Value="TimeEndFormatted">End Time</asp:ListItem>--%>
                    </asp:CheckBoxList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td colspan="3">
                    <br />
                      <span style="font-size:10px;"> Download all the videos, audios, or images related to your:</span>
                    <br />
                      <asp:CheckBox ID="chkFirstAppearance" runat="server" Checked="false" Text="Show only the first appearance of commerical"  Visible="false"/>
                 <asp:CheckBox ID="chkDownload" runat="server" Checked="false" Text="category" Font-Bold="true"/>
                  &nbsp;
                  <asp:CheckBox ID="chkDownloadProduct" runat="server" Checked="false" Text="product" Font-Bold="true"/>
               &nbsp;
                   <asp:CheckBox ID="chkDownloadAdvertiser" runat="server" Checked="false" Text="advertiser" Font-Bold="true"/>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td colspan="3">
                    <asp:ImageButton ID="btnSearch" runat="server" OnClick="btnSearch_Click" SkinID="Search" />
                    <asp:UpdatePanel ID="pnlUpdate_Submit" runat="server">
                        <ContentTemplate>
                            <asp:Label ID="lblErrorMsg" runat="server" Text="" ForeColor="red"></asp:Label>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnSearch" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
